import { ConfigType, registerAs } from '@nestjs/config'

import { env, envBoolean, envNumber } from '@/utils/env'

export const jwtRegToken = 'jwt'

export const JwtConfig = registerAs(jwtRegToken, () => ({
	secretKey: env('JWT_SECRET'),
	expiresIn: envNumber('JWT_EXPIRE'),
	refreshSecret: env('REFRESH_TOKEN_SECRET'),
	refreshExpire: envNumber('REFRESH_TOKEN_EXPIRE'),
}))

export type IJwtConfig = ConfigType<typeof JwtConfig>
